home *** CD-ROM | disk | FTP | other *** search
- integer function abs( integer i )
- {
- if i<0 then
- return(-i);
- else
- return(i);
- endif;
- };
-
-
- assume string side; integer x,y,skill; (null) expression tactic in
- {
- let (null) expression movefunc :=
- {
- null function move()
- {
- integer shot;
- integer epos;
- integer ex,ey;
-
- foreach i in tank.get_instances() do
- {
- shot := false;
- epos := i.get_pos(side);
- ey := epos/256;
- ex := epos - (ey*256);
- if epos<>-1 and abs(y-ey)<4 and abs(x-ex)<4 and rnd(3)<>1 then
- shot := true;
- foreach s in [".","|",".","|",".","|",
- ".","|",".","|",".","|",
- ".","|",".","|",".","|",
- ".","|",".","|",".","|",
- ".","|",".","|",".","|",
- ".","|",".","|",".","|"] do
- {
- tab(x,y);
- write(s);
- };
- if rnd(100)<skill then
- i.blowup();
- sys_delete_object(i,false);
- endif;
- endif;
- if not shot then
- run(tactic);
- if rnd(10)=1 then
- integer nt;
- nt := rnd(10);
- if nt=1 or nt=2 then
- i.set_tactic(retreat);
- else
- if nt=3 or nt=4 or nt=5 then
- i.set_tactic(advance);
- else
- if nt=6 then
- i.set_tactic(panic);
- else
- if nt>6 then
- i.set_tactic(default);
- endif;
- endif;
- endif;
- endif;
- endif;
- endif;
- };
- };
- };
- };
-
-
- tank.add_method( movefunc );
-
- #tank gt1;
- #tank at1;
- #tank gt2;
- #tank at2;
- #tank gt3;
- #tank gt4;
- #tank at3;
- #tank gt5;
-
-
- gt1.set("German",10,3,30);
- gt2.set("German",10,6,30);
- gt3.set("German",10,9,30);
- gt4.set("German",10,12,30);
- gt5.set("German",10,15,30);
-
- at1.set("American",15,5,60);
- at2.set("American",15,15,60);
- at3.set("American",25,10,90);
-